import axios from "@/http/axios";
import type { ClassDataConfig } from "../type";

interface AddClassroomProps {
  id?: number | null; // id
  classroomLocation: string; // 教室所在位置,例如7栋7楼
  classroomName: string; // 教室名称,例如6教,29教
  maxSize: number; // 最大容纳人数
  used: number; // 是否在用,0-空置 1-在用
}
// 查询教室
export const getClassroomApi = (params: ClassDataConfig) =>
  axios({
    url: "/exam/classroom/getAll",
    method: "POST",
    params,
  });

// 添加教室
export const addClassroomApi = (params: AddClassroomProps) =>
  axios({
    url: "/exam/classroom/add",
    method: "POST",
    params,
  });

// 删除教室
export const delClassroomApi = (id: number) =>
  axios({
    url: "/exam/classroom/del",
    method: "POST",
    params: {
      id,
    },
  });

// 根据 id 查询教室
export const getClassroomByIdApi = (id: number) =>
  axios({
    url: "/exam/classroom/getById",
    method: "POST",
    params: {
      id,
    },
  });

// 编辑
export const editClassroomApi = (params: AddClassroomProps) =>
  axios({
    url: "/exam/classroom/modify",
    method: "POST",
    params,
  });
